package com.hbusa.cotroller.image;

import com.hbusa.service.impl.ImageServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.SchemaOutputResolver;
import java.io.IOException;

/**
 * @author XiaoXin
 * @date 2021/12/27 - 4:04
 */

@WebServlet("/admin/doDel")
public class DelServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String picture_id = req.getParameter("picture_id");
        ImageServiceImpl imageService = new ImageServiceImpl();
        boolean b = imageService.removeById(Integer.parseInt(picture_id));
        if (b) {
            System.out.println("删除成功");
        } else {
            System.out.println("删除失败");
        }
        req.getRequestDispatcher("doList").forward(req, resp);
    }
}
